PROJECT=KegScale

PROCESSOR=PIC18F1320
SERIES=18

HEX=../hex
OBJ=../obj

PIC_LD=wine ${SOURCEBOOST}/boostlink.pic.exe -t ${PROCESSOR} -ld ${SOURCEBOOST}/Lib/ libc.pic${SERIES}.lib

PIC_CC=wine ${SOURCEBOOST}/boostc.pic${SERIES}.exe -t ${PROCESSOR} -i -obj ${OBJ}

all: dummy ${HEX}/${PROJECT}_boost.hex ${HEX}/${PROJECT}_gpasm.hex

dummy:
	mkdir ${OBJ} 2> /dev/null || true
	mkdir ${HEX} 2> /dev/null || true

${HEX}/${PROJECT}_boost.hex: ${OBJ}/kegscale.obj ${OBJ}/menu.obj ${OBJ}/gc_menu.obj ${OBJ}/eeprom.obj ${OBJ}/usart.obj
	$(PIC_LD) -p ${PROJECT}_boost -d ../hex $^

${HEX}/${PROJECT}_gpasm.hex: ${HEX}/${PROJECT}_boost.hex
	gpasm -p ${PROCESSOR} -o ${HEX}/${PROJECT}_gpasm.hex ${HEX}/${PROJECT}_boost.asm

${OBJ}/kegscale.obj: kegscale.c menu.h gc_menu.h globalopts.h lcd.h usart.h p18f1320_extra.h
	$(PIC_CC) $<

${OBJ}/menu.obj: menu.c menu.h gc_menu.h globalopts.h eeprom.h lcd.h usart.h
	$(PIC_CC) $<

${OBJ}/gc_menu.obj: gc_menu.c gc_menu.h globalopts.h
	$(PIC_CC) $<

${OBJ}/eeprom.obj: eeprom.c eeprom.h
	$(PIC_CC) $<

${OBJ}/usart.obj: usart.c usart.h
	$(PIC_CC) $<

